package com.lanou.myapp.news;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;


import java.util.ArrayList;

/**
 * Created by dllo on 16/1/10.
 */
public class NewsAdapter extends FragmentPagerAdapter {
    private ArrayList<Fragment> data;
    private Context context;


    String title1 = "每日推荐";
    String title2 = "动漫趣闻";
    String title3 = "电影新闻";
    String title4 = "游戏新闻";

    String[] titles = {title1, title2, title3, title4};

    public NewsAdapter(FragmentManager fm, ArrayList<Fragment> data, Context context) {
        super(fm);
        this.data = data;
        this.context = context;
    }

    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
